package com.robert.vesta.service.intf;

import com.robert.vesta.service.bean.Id;

import java.util.Date;

public interface IdService {
    /**
     * 用来产生唯一ID的主要API
     * @return
     */
    public long genId();

    /**
     * 唯一通过long类型的ID来生成ID对象的反向操作
     * @param id
     * @return
     */
    public Id expId(long id);

    /**
     * makeId都是用来伪造某一时间的ID
     * @param time
     * @param seq
     * @return
     */
    public long makeId(long time, long seq);

    public long makeId(long time, long seq, long machine);

    public long makeId(long genMethod, long time, long seq, long machine);

    public long makeId(long type, long genMethod, long time,
                       long seq, long machine);

    public long makeId(long version, long type, long genMethod,
                       long time, long seq, long machine);

    /**
     * 将整型时间翻译成格式化时间
     * @param time
     * @return
     */
    public Date transTime(long time);
}
